package login

import (
	"gopkg.in/mgo.v2/bson"
	"gitee.com/dayu1985/framework/net/web"
	"time"
	"gitee.com/dayu1985/can_api/tests/base"
)

var userUrls map[string]string
func init() {
	userUrls = map[string]string{
		"login":base.Bt.AppBase + "/v1.0/login.json",
	}
}

func Login() string{
	param := bson.M{
		"app":"5ab3464b33fa17124cde19ad",
		"username":"test",
		"password":web.EncBase64("test123"),
	}

	data, _ := base.POST(userUrls["login"],param,time.Now().UnixNano(),true)
	if data != nil {
		dd,_ := data.(map[string]interface{})
		token,_ := dd["access_token"].(string)
		base.Token = token
	}
	return ""
}
